package cn.kgc.springcloud.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: mosin
 * @version: v1.0  2022/6/13
 * 使用java代码完成路由配置
 */
public class GateWayConfig {

    public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
        return  builder.routes()
                .route("product_router",r->r.path("/product/**")
                        .uri("http://localhost:8787"))
                .build();
    }
}
